package test;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
 * @author dengzhiyuan
 * @version 1.0
 * @time 2021/3/30 15:43
 */
public class User<T> {

    public static void main(String[] args) {

//        User<Entity> user = new User<Entity>();
//        Type genericSuperclass = user.getClass().getGenericSuperclass();
//        System.out.println(genericSuperclass);
//        LocalDateTime dateTime = LocalDateTime.now();
//        dateTime = dateTime.minusDays(1);
//        dateTime = dateTime.withMinute(59);
//        dateTime = dateTime.withHour(23);
//        dateTime = dateTime.withSecond(59);
//        System.out.println(dateTime);
//        SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd");//显示2017-10-27格式
//        Calendar calendar = Calendar.getInstance();
//        calendar.setTime(new Date());
//        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        System.out.println(sdf2.format(calendar.getTime()));
//        new User<>().test3();
//        long l = System.currentTimeMillis();
//        try {
//            TimeUnit.SECONDS.sleep(5L);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        System.out.println(System.currentTimeMillis()-l);
        String idcard = "3623**********2810";
        StringBuilder sb = new StringBuilder(StrUtil.sub(idcard,0,4 ));
        sb.append("%");
        sb.append(StrUtil.sub(idcard,idcard.length()-4 ,idcard.length()));
        System.out.println(sb.toString());

        System.out.println(IdcardUtil.isValidCard18(idcard));

    }

    public void test1(){
        String fileName = "abc-2018.xls";
        System.out.println(fileName.split("\\.")[0].split("\\-")[1]);
    }
    public void test2(){
        System.out.println(new BigDecimal(1));
        System.out.println(new BigDecimal(1L));
        System.out.println(new BigDecimal(1D));
    }

    public void test3(){
        List<String> list = Arrays.asList("11","22","33","11");
        System.out.println(list.stream().collect(Collectors.toSet()));
    }


}
